<template>
    <div class="news_box infor_box">
      <!-- 标题 -->
      <div class="server_titleBox">
          <div class="server_title">
            <span class="line"></span>
            <span class="main_titles">新闻资讯</span>
            <span class="line"></span>
          </div>
          <p class="under_title">News information</p>
      </div>
      <!-- 具体内容 -->
      <div class='news_content'>
          <div class="much"><nuxt-link to="./news/international">更多  >></nuxt-link></div>
          <div class="news_detail">
               <ul style="height:380px;overflow:hidden;">
                <li v-for="(item,index) in listData" :key="index">
                    <router-link v-if="item.contentType==50"  :to="'/news/international/'+item.contentId">
                        <div>
                           <img :src="FileUploadUrl2+item.coverPath+item.coverPic" alt="">
                        </div>
                        <h2 class="wy-text-nowrap">{{item.contentTitle}}</h2>
                        <p class="wy-text-nowrap-2">{{replaceHtml(item.contentTxt)}}</p>
                     </router-link>
                    <router-link v-if="item.contentType==51" :to="'/news/internal/'+item.contentId">
                        <div>
                           <img :src="FileUploadUrl2+item.coverPath+item.coverPic" alt="">
                        </div>
                        <h2 class="wy-text-nowrap">{{item.contentTitle}}</h2>
                        <p class="wy-text-nowrap-2">{{replaceHtml(item.contentTxt)}}</p>
                     </router-link>
                    <router-link v-if="item.contentType==52" :to="'/news/province/'+item.contentId">
                        <div>
                           <img :src="FileUploadUrl2+item.coverPath+item.coverPic" alt="">
                        </div>
                        <h2 class="wy-text-nowrap">{{item.contentTitle}}</h2>
                        <p class="wy-text-nowrap-2">{{replaceHtml(item.contentTxt)}}</p>
                     </router-link>
                    <router-link v-if="item.contentType==53" :to="'/news/industry/'+item.contentId">
                        <div>
                           <img :src="FileUploadUrl2+item.coverPath+item.coverPic" alt="">
                        </div>
                        <h2 class="wy-text-nowrap">{{item.contentTitle}}</h2>
                        <p class="wy-text-nowrap-2">{{replaceHtml(item.contentTxt)}}</p>
                     </router-link>
                  </li>
                 <!--  <li v-for="(item,index) in listData" :key="index" v-if="item.contentType==1||item.contentType==2||item.contentType==3||item.contentType==4">
                  <router-link v-if="item.contentType==1" :to="'/news/international/'+item.contentId">
                        <div>
                           <img :src="item.imgUrl" alt="">
                        </div>
                        <h2 class="wy-text-nowrap">{{item.contentTitle}}</h2>
                        <p class="wy-text-nowrap-2">{{replaceHtml(item.contentTxt)}}</p>
                     </router-link>
                  <router-link v-if="item.contentType==2" :to="'/news/internal/'+item.contentId">
                        <div>
                           <img :src="item.imgUrl" alt="">
                        </div>
                        <h2 class="wy-text-nowrap">{{item.contentTitle}}</h2>
                        <p class="wy-text-nowrap-2">{{replaceHtml(item.contentTxt)}}</p>
                     </router-link>
                  <router-link v-if="item.contentType==3" :to="'/news/province/'+item.contentId">
                        <div>
                           <img :src="item.imgUrl" alt="">
                        </div>
                        <h2 class="wy-text-nowrap">{{item.contentTitle}}</h2>
                        <p class="wy-text-nowrap-2">{{replaceHtml(item.contentTxt)}}</p>
                     </router-link>
                  <router-link v-if="item.contentType==4" :to="'/news/industry/'+item.contentId">
                        <div>
                           <img :src="item.imgUrl" alt="">
                        </div>
                        <h2 class="wy-text-nowrap">{{item.contentTitle}}</h2>
                        <p class="wy-text-nowrap-2">{{replaceHtml(item.contentTxt)}}</p>
                     </router-link>
                  </li> -->
               </ul>
          </div>
      </div>
    </div>
</template>
<script>
import { newsData } from '@/utils/newsData'
import { environment } from '@/server/environment'
export default {
    data() {
      return {
        // listData: newsData.international.slice(0,4)
        listData:[],
        FileUploadUrl2:environment.FileUploadUrl2,

      }
    },
    beforeCreate() {
    },
  created(){
    this.tofindNews()
  },
  methods:{
    //新闻查询
      async tofindNews () {
          const res = await this.$store.dispatch('news/tofindNews',{
          pageSize: 10,
          pageNum: 1,
          contentCode:15
    
          })
          if (res.status) {
            this.listData = res.data.rows;


          } 
      },
       replaceHtml(str){
        return str.replace(/<[^>]+>/g,'')
      }
  }
  }
</script>
<style lang="scss" >

</style>